package planesimulator.plane.wing.coefficients;

/**
 * Lift coefficient for main wing
 * @author Jakub Klimek
 */
public class StandartLiftCoefficient implements LiftCoefficient {

  float keys[] = {
    0.000000f,
    2.000000f,
    4.000000f,
    6.000000f,
    8.000000f,
    10.000000f,
    12.000000f,
    14.000000f,
    16.000000f,
    18.000000f,
    90.000000f,
    180.0f
  };
  float values[] = {
    0.0f,
    0.599734f,
    0.800088f,
    0.999362f,
    1.147106f,
    1.263215f,
    1.347949f,
    1.333211f,
    1.231235f,
    1.108845f,
    0.826031f,
    0f
  };
  ValueTable vt;

  public StandartLiftCoefficient() {
    vt = new ValueTable(11, keys, values);
  }

  public float lift(float deg) {

    if (deg < 0) {
      return -vt.interpolate(-deg);
    } else {
      return vt.interpolate(deg);
    }
  }
}
